import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '流水号',
    align:"center",
    dataIndex: 'lsh'
   },

   {
    title: '编号',
    align:"center",
    dataIndex: 'ph'
   },

   {
    title: '承包商',
    align:"center",
    dataIndex: 'cbs'
   },

   {
    title: '收款日期',
    align:"center",
    dataIndex: 'skrq',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },

   {
    title: '收款金额',
    align:"center",
    dataIndex: 'skjg'
   },

   {
    title: '退保证金',
    align:"center",
    dataIndex: 'tbzj'
   },

   {
    title: '收款地址',
    align:"center",
    dataIndex: 'skdz'
   },

   {
    title: '票据号码',
    align:"center",
    dataIndex: 'pjhm'
   },

   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '承包商',
    field: 'cbs',
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [

  {
    label: '流水号',
    field: 'lsh',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入流水号!'},
          ];
     },
  },

  {
    label: '编号',
    field: 'ph',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入编号!'},
          ];
     },
  },

  {
    label: '承包商',
    field: 'cbs',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入承包商!'},
      ];
    },
  },
  {
    label: '收款日期',
    field: 'skrq',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入收款日期!'},
          ];
     },
  },

  {
    label: '收款金额',
    field: 'skjg',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入收款金额!'},
          ];
     },
  },

  {
    label: '退保证金',
    field: 'tbzj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入退保证金!'},
          ];
     },
  },

  {
    label: '收款地址',
    field: 'skdz',
    component: 'Input',
  },
  {
    label: '票据号码',
    field: 'pjhm',
    component: 'Input',
  },


  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
